package com.pubinfo.passbook.data.controller.open;

import com.pubinfo.passbook.common.model.dto.contract.GatheringData;
import com.pubinfo.passbook.common.model.dto.contract.InvoiceData;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("crm")
@Api(tags = "crm系统接口")
public class CRMController {
  /**
   * 发票数据：合同编号，受理订单编号，开票日期，发票代码，对方单位名称，开票金额，税率，税金
   * 收款数据：合同编号、受理订单编号、金额、金额、付款方、收款时间
   * <p>
   * 不知道有没有发票和付款取消的场景，有的话，最好区分一下。
   *
   * @param invoiceData
   * @return
   */
  @PostMapping("invoiceData")
  @ApiOperation(value = "发票数据接收")
  public JsonResult<Boolean> invoiceData(@RequestBody InvoiceData invoiceData) {
  
    return JsonResult.success(true);
  }
  
  @PostMapping("gatheringData")
  @ApiOperation(value = "收款数据接收")
  public JsonResult<Boolean> gatheringData(@RequestBody GatheringData gatheringData) {
    return JsonResult.success(true);
  }
  
  @GetMapping("cancel/{id}/{type}")
  @ApiOperation(value = "发票数据|收款数据取消")
  public JsonResult<Boolean> cancel(@ApiParam(value = "发票数据|收款数据 id", required = true) @PathVariable("id") String id, @ApiParam(value = "类型 发票数据为1，收款数据为2", required = true) @PathVariable("type") Integer type) {
    return JsonResult.success(true);
  }
  
}
